from django.urls import path

from system import views
from system.api.user_info import UserInfoView

urlpatterns = [
    path('captcha/', views.CaptchaView.as_view(), name='获取验证码'),
    path('login/', views.LoginView.as_view(), name='登录'),
    path('register/', views.RegisterView.as_view({'post': 'create'}), name='注册'),
    path('refresh/', views.CustomTokenRefreshView.as_view(), name='刷新token'),

    path('permission/', views.PermissionView.as_view({'get': 'list', 'post': 'create', 'delete': 'multiple_destroy'}), name='权限'),
    path('permission/<int:pk>/', views.PermissionView.as_view({'put': 'partial_update'}), name='修改权限'),
    path('get_all_permission/', views.PermissionAllView.as_view({'get': 'get'}), name='获取所有权限'),
    path('generate_url_permission/', views.UrlListView.as_view({'post': 'post'}), name='生成路由权限'),


    path('role/', views.RoleView.as_view({'get': 'list', 'post': 'create', 'delete': 'multiple_destroy'}), name='角色'),
    path('role/<int:pk>/', views.RoleView.as_view({'put': 'partial_update'}), name='修改角色'),
    path('get_all_role/', views.RoleAllView.as_view({'get': 'get'}), name='获取所有角色'),

    path('user_list/', views.UserListView.as_view({'get': 'list', 'delete': 'multiple_destroy', 'post': 'create'}, name='用户列表')),
    path('user_list/<int:pk>/', views.UserUpdateListView.as_view({'put': 'partial_update'}, name='更新用户信息')),


    path('api_white/', views.ApiWhiteListView.as_view({'get': 'list', 'post': 'create', 'delete': 'multiple_destroy'}), name='接口白名单'),
    path('api_white/<int:pk>/', views.ApiWhiteListView.as_view({'put': 'partial_update'}), name='接口白名单'),

    path('userinfo/<int:pk>/', UserInfoView.as_view({'get': 'retrieve', 'put': 'partial_update', 'post': 'post'}), name='用户信息'),

]
